package org.wattdepot.cli.command;

import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;

/**
 * Test for Total Power Fuel Type.
 * 
 * @author Remy Baumgarten
 * @author Kevin Chiogioji
 * 
 */
public class TestTotalPowerFuelType {

  private static final String kahe = "SIM_KAHE";
  private static final String time = "2009-10-26T18:15:00.000-10:00";
  
  
  /**
   * Power Generated from waste.
   * 
   * @throws Exception -
   */
  @Test
  public void powerGeneratedWaste() throws Exception {
    TotalPowerFuelType power = new TotalPowerFuelType();
    List<String> args = new ArrayList<String>();
    args.add("SIM_IPP");
    args.add(time);
    args.add("waste");
    System.out
        .println("TotalPowerFuelType Class:  Testing output for power generated from waste..");
    assertTrue("Checking power generated for SIM_IPP at 2009-10-26T18:15:00.000-10:00 from waste",
        power.doCommand(args).contains("46.0 MW"));
  }

  /**
   * Power Generated from coal.
   * 
   * @throws Exception -
   */
  @Test
  public void powerGeneratedCoal() throws Exception {
    TotalPowerFuelType power = new TotalPowerFuelType();
    List<String> args = new ArrayList<String>();
    args.add(kahe);
    args.add(time);
    args.add("coal");
    System.out.println("TotalPowerFuelType Class:  Testing output for power generated from coal..");
    assertTrue("Checking power generated for SIM_KAHE at 2009-10-26T18:15:00.000-10:00 from coal",
        power.doCommand(args).contains("0.0 MW"));
  }

  /**
   * Power Generated from LSFO.
   * 
   * @throws Exception -
   */
  @Test
  public void powerGeneratedLSFO() throws Exception {
    TotalPowerFuelType power = new TotalPowerFuelType();
    List<String> args = new ArrayList<String>();
    args.add(kahe);
    args.add(time);
    args.add("LSFO");
    System.out.println("TotalPowerFuelType Class:  Testing output for power generated from LSFO..");
    assertTrue("Checking power generated for SIM_KAHE at 2009-10-26T18:15:00.000-10:00 from LSFO",
        power.doCommand(args).contains("463.0 MW"));
  }

  /**
   * Test Input Validation 1.
   * 
   * @throws Exception -
   */
  @Test
  public void testInputValidation1() throws Exception {
    TotalPowerFuelType power = new TotalPowerFuelType();
    List<String> args = new ArrayList<String>();
    args.add(kahe);
    args.add("2009-10-2612");
    args.add("waste");
    System.out.println("Checking input validation..." + power.doCommand(args));
    assertTrue("Checking input validation for ", power.doCommand(args).contains(
        "Invalid TimeStamp Formatting"));
  }

  /**
   * Test Input Validation 2.
   * 
   * @throws Exception -
   */
  @Test
  public void testInputValidation2() throws Exception {
    TotalPowerFuelType power = new TotalPowerFuelType();
    List<String> args = new ArrayList<String>();
    args.add("SIM_FAKE");
    args.add(time);
    args.add("waste");
    System.out.println("Checking input validation..." + power.doCommand(args));
    assertTrue("Checking input validation for ", power.doCommand(args).contains(
        "This resource is not available"));
  }

  /**
   * Test Input Validation 3.
   * 
   * @throws Exception -
   */
  @Test
  public void testInputValidation3() throws Exception {
    TotalPowerFuelType power = new TotalPowerFuelType();
    List<String> args = new ArrayList<String>();
    args.add(kahe);
    args.add(time);
    args.add("gas");
    System.out.println("Checking input validation..." + power.doCommand(args));
    assertTrue("Checking input validation for ", power.doCommand(args).contains(
        "Invalid fuel type."));
  }
}
